#!/bin/sh
j="jdbc:oracle:thin:@192.168.3.69:1521:ORCL"
u="ods"
p="123456"
t="SYS_USER_INFO"
t1="ORG_INFO"
d="ods"
echo "---------------------开始抽取oracle数据hive-----------------------------------"
echo "-----------开始抽取SYS_USER_INFO表数据---------------"
sqoop import \
--hive-import \
--connect ${j} \
--username ${u} \
--password ${p} \
--table ${t} \
--hive-database ${d} \
--fields-terminated-by ',' -m 1
echo $?
c=`hive -e "set hive.exec.mode.local.auto=true;select count(*) from ${d}.${t};"`
echo "----------------SYS_USER_INFO数据已抽取完成,一共抽取了${c}条数据--------"
echo "---------------------------------------------------------------"
echo "-----------开始抽取ORG_INFO表数据---------------"
sqoop import \
--hive-import \
--connect ${j} \
--username ${u} \
--password ${p} \
--table ${t1} \
--hive-database ${d} \
--fields-terminated-by ',' -m 1
echo $?
c=`hive -e "set hive.exec.mode.local.auto=true;select count(*) from ${d}.${t1};"`
echo "----------------ORG_INFO表数据已抽取完成,一共抽取了${c}条数据--------"
echo "---------------------------------------------------------------"
echo "-----------数据抽取完成---------------"